> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/jaypopat/cf_ai_duet/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating and Joining Rooms

> Set up pairing rooms to collaborate with others

Rooms are the core of Duet - isolated pairing sessions where you share a terminal, workspace, and AI assistant with collaborators.

## Creating a Room

<Steps>
  <Step title="Navigate to Create screen">
    From the launch screen, press:

    * `c` or `C` to create a room, or
    * Arrow keys to select "Create Room" and press `Enter`
  </Step>

  <Step title="Add a description (optional)">
    Enter a description for your room. This helps:

    * Generate a readable workspace name (e.g., "react-debugging" becomes the workspace folder name)
    * Identify the room's purpose

    If you skip the description, Duet generates a random name like "swift-phoenix" or "cosmic-dragon" (see internal/room/manager.go:26-27, 74).
  </Step>

  <Step title="Confirm creation">
    Press `Enter` to create the room.

    You'll see a confirmation screen displaying your unique Room ID - share this with collaborators so they can join.
  </Step>

  <Step title="Enter the room">
    Press `Enter` again to enter your newly created room.
  </Step>
</Steps>

## Joining a Room

<Steps>
  <Step title="Navigate to Join screen">
    From the launch screen, press:

    * `J` (shift+j) to join a room, or
    * Arrow keys to select "Join Room" and press `Enter`
  </Step>

  <Step title="Enter the Room ID">
    Paste or type the Room ID provided by the room creator.
  </Step>

  <Step title="Confirm and join">
    Press `Enter` to join the room.

    You'll immediately enter the shared terminal session with all other participants.
  </Step>
</Steps>

## Room Features

When you create or join a room, you get:

### Isolated Workspace

Each room has its own workspace directory (internal/room/manager.go:82-91):

* Located in `/app/workspaces/<workspace-name>/`
* Copies from a workspace template that includes nvim and Node.js
* Automatically cleaned up when the last user leaves

### Shared Terminal

All users in a room share the same terminal session:

* Live synchronization of all terminal input/output
* See what others are typing in real-time
* Terminal content updates are broadcast to all participants

### Dedicated AI Assistant

Each room has its own AI agent instance (cf-worker/index.ts:89-267):

* Maintains conversation context specific to the room
* Stores up to 50 messages in history
* Persists state using Cloudflare Durable Objects
* One Cloudflare Sandbox per room for executing commands

## Room Lifecycle

### Active Rooms

A room stays active as long as at least one user is connected. New users can join at any time and will see:

* The current terminal state
* Full AI conversation history
* All users currently in the room

### Room Cleanup

When the last user leaves a room (internal/room/manager.go:132-148):

* The terminal session closes
* The workspace directory is deleted
* The Cloudflare Sandbox is destroyed
* The AI agent state is reset
* The room is removed from the server

## Navigation

### In the Launch Screen

* `up`/`k` and `down`/`j` - Navigate menu options
* `c` - Quick create room
* `J` - Quick join room
* `q` or `esc` - Quit Duet
* `ctrl+c` - Force quit

### Leaving a Room

* `ctrl+l` - Leave current room and return to launch screen
* `esc` - Back to previous screen (when on Create/Join screens)

## User Indicators

In the room's user list sidebar, you'll see labels:

* `(host)` - The user who created the room
* `(you)` - Your own username
* Real-time join/leave notifications

See internal/ui/model.go:596-614 for the user list implementation.

## Tips

* Room IDs are UUIDs - save them somewhere if you need to reconnect
* Descriptive room names make it easier to identify workspace directories
* The room creator doesn't have special privileges - all users have equal access to the terminal and AI
